All Questions
Tagged with replacetext-processing
96 questions
3votes
5answers
645views
removing braces statements containing nested braces inside
A typical latex problem: \SomeStyle{\otherstyle{this is the \textit{nested part} some more text...}} Now I want to remove all \SomeStyle{...} but not the content. Content contains nested braces. The ...
0votes
0answers
147views
Find and replace in CudaText editor
So I have dump from U-boot and I need to replace specific string in CudaText editor. Here is mine text e101b1e0: 30ef27d8 e792f415 9beea618 5c601de4 .'.0..........`\ e101b1f0: aeaf9d25 e1dd63e9 ...
0votes
2answers
256views
Merge two two-column files based on a common first column prefering values from the second column of a given file
I have two text files 1.txt and 2.txt that contain two tab separated columns. The first column of both files consists of tokenized text. In both files, the first column is the same. The word order ...
0votes
3answers
2kviews
How to replace all matched strings in the files recursively?
There are about 50 HTML/js files in the folder name site, some of the files contain (below lines are combined from files) {"rendered":"http:\/\/localhost:4542\/?page_id=854"} ...
-1votes
3answers
499views
awk print only modified lines
I have file like this d1000 1000 d1001 100 d1002 10 d1003 1 I want to modify second column where length is not equal 4. But I want to print only lines that are modified, so original text in column 2 ...
13votes
8answers
2kviews
How can I replace a character within a specific context in each line of the whole file?
I have a large file which contains hundreds of English phrases in the following form: \phrase {. . . * * } {I shoul-d've stayed home.} {aɪ ʃʊd‿əv ˈsteɪd ˈhoʊm.} <- only replace on ...
1vote
5answers
1kviews
Replace hyphen(s) with underscore(s) within angle brackets in a file
I’m aware of how to replace string; e.g., replace hyphen with underscore in a file. However, I wish to replace all hyphens with underscore for all text that falls within angle brackets in a given file....
3votes
2answers
4kviews
How to substitute non printable characters with space character in a file
I have read nearly every answer about this topic on this website or Stackoverflow but didn't manage to solve the issue below. When I copy the text from a PDF file and paste it into a text file file....
-1votes
1answer
86views
How to search and replace text in files but keep/reuse a certain part of text?
I want to refactor many JavaScript files in many directories which contain access to an object in this format: myObj.something.somethingElse and I want it to be myObj.getSomething(somethingElse) how ...
2votes
2answers
5kviews
Alternative to sed -i that does not write temporary files
I have several scripts that edit template text files, by removing a "tag" and replacing it with e.g. a number. To do this I use the sed -i command. However, I have an issue with write/read ...
0votes
1answer
106views
replace string from left to right in a line
I want to search and replace the negative values with the value just before it. The values are separated by comma. Example: ocv_sigma_cell_rise(table_7) { sigma_type : early_and_late; values(&...
1vote
2answers
940views
Replace several consecutive lines with a single line using sed
In all my python scripts, I'd like to replace the 2 consecutive lines import matplotlib as mpl mpl.style.use(mpl_plt_default_template) with just the line plt.style.use(mpl_plt_default_template) So ...
-1votes
2answers
99views
replace a particular text after N-th occurrence of a character
I want to replace the numbers in below file with #Mi. Only for numbers after the 10th occurrence of " (double quote) Input File "col1" "col2" "col3" "col4" ...
1vote
1answer
159views
How to replace text between quotation marks with something from another file?
I have the following kind of text: $OU = 'or'; $DINHEIRO_CAIXA = 'Cash balance'; $PAGINA = 'Page'; $DE = 'from'; $ENVIAR = 'Send'; $PRINCIPAL = 'Main'; I've already got all the text within the single ...
3votes
6answers
3kviews
Using sed to replace substrings between specific tags
I want to combine two sed command in one and really don't know how to do it, I've tried multiple things without success. For the result I want all slash between a specific tag to be replaced with ...